import { useState } from "react";
import HCascader from "_c/cascader";
import { OPTIONS } from "./constans";

export default function DemoItem({
  item: {
    fieldNames,
    title,
    desc,
    disabled,
    defalutValue,
    options,
    changeOnSelect,
    hasSearch
  },
}) {
  const [value, setValue] = useState([]);

  return (
    <div className="demo-item">
      <h3>{title}</h3>
      <p>{desc}</p>
      <p>value: {JSON.stringify(value)}</p>
      <HCascader
        options={options || OPTIONS}
        disabled={disabled}
        defalutValue={defalutValue || []}
        fieldNames={fieldNames}
        onChange={(e) => setValue(e)}
        changeOnSelect={changeOnSelect}
        hasSearch={hasSearch}
      ></HCascader>
    </div>
  );
}
